﻿//======================================================================
//
//        Copyright (C) 2015   
//        All rights reserved
//
//        filename : PutOutApply
//        description : 半成品/成品卡申领
//        created by 任卫华 at  20160108
//
//======================================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CardLogistics.Web.Components;
using System.Data;

namespace CardLogistics.Web.MainPage.PutOutCard.PutOutApply
{
    public partial class Detail : BasePage
    {
        private static readonly CardLogistics.DAL.PutOutCard.PutOutApplyData DAL = new DAL.PutOutCard.PutOutApplyData();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                InitControl();
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public void InitControl()
        {
            string _key = Request.QueryString["id"];
            WebUserControl_AppInfo1.InfoID = _key;
            WebUserControl_AppInfo1.UserID = LoggedUser.ID;
            if (!string.IsNullOrEmpty(_key))
            {
                CardLogistics.Model.PutOutCard.PutOutApply pData = DAL.GetModel(_key);
                SetWebControls(this.Page, pData);
                if (pData!= null)
                {
                    //申领日期
                    if (pData.APPLYDATE != null)
                    {
                        APPLYDATE.Text = DateTime.Parse(pData.APPLYDATE.ToString()).ToString("yyyy-MM-dd");
                    }
                    //需求截止日期
                    if (pData.DemandEndDate != null)
                    {
                        DEMANDENDDATE.Text = DateTime.Parse(pData.DemandEndDate.ToString()).ToString("yyyy-MM-dd");
                    }
                    ApplyTotal.Text = pData.CARDNUMBER.ToString();//申领数量
                    DemandTotal.Text = pData.DemandTotal.ToString(); //需求数量
                    NotApplyTotal.Text = pData.NotApplyTotal.ToString();//剩余可申领数量
                }
            }
        }
    }
}